#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define WORD 81
void function ();
void function2 ();
char message[WORD][WORD];
char m[WORD];
int i , j=0, n , cnt ,d;
int main()
{    
   printf("Please enter the sentence:\n");
   function();
   d = i;
   cnt = i;
   function2(); 
   printf("the sentence you enter is:\n");
   i=0;
   for ( i ; i <= cnt; i++)
   {
     if (message[i][0] == '0')
     continue;
     printf("%s ",message[i]); 
   }
   return 0;
}
void function ()
{   
    
    i=0;
    char c;    
    while (j < (WORD-1) && (c = getchar()) != '\n' )
    {
       if (!isspace(c))
       {
          message[i][j] = c;
          j++;
       }
       if (isspace(c))
       {
           i++;
           j=0;
           message[i][j] = '0';
       }
    }
     
}
void function2 ()
{
 for ( d ; d>0 ; d=d-1 )
 {
  for ( i = cnt ; i > 0 ;  )
  {
    n = strcmp(message[i],message[i-1]);
    if (n <= 0)
    {
        if (n == 0)
        {
          message[i-1][0] = '0';
        }
        
        strcpy(m,message[i-1]);
        strcpy(message[i-1],message[i]);
        strcpy(message[i],m);
        
    }
    i=i-1;
  } 
 }  
}